
/**
 * 
 */

/**
 * @author M.O
 *
 */
public class BigInteger {
	int number;
	
	public BigInteger() {}
	
	public BigInteger(int init) {
		this.number = init;
	}
	
	public BigInteger(String _number) {
		super();
		this.number = Integer.parseInt(_number);
	}

	/**
	 * Return type String of BigInteger
	 */
	public String toString() {
		return String.valueOf(number);
	}
	
	public String toLong() {
		Long obj = new Long(number);
		return obj.toString();
	}
	
	/**
	 * Chuyen chuoi thanh mang ky tu
	 * @param s
	 * @return
	 */
	public char[] trimString(String s) {
		char temp [] = s.toCharArray();
		
		return temp;
	}
	
	/**
	 * Ham cong hai so nguyen voi nhau
	 * @param a
	 * @param b
	 * @return
	 */
	public int addNumber(int a, int b) {
		int temp = 0;
		
		temp = a + b;
		return temp;
	}
	/**
	 * This method perform to add two BigInteger
	 * Idea: Moi so bieu dien duooi dang string, ky tu dau tien bieu thi so am hay duong
	 * Neu ky tu dau tien la 0: no la so duong; 1: la so am
	 * De cong 2 so lon voi nhau:
	 * 1. Dao nguoc chuoi cua moi so.
	 * 2. Day moi so vao moi mang String, moi phan tu cua mang la 1 chu so cua so do.
	 * 3. Cong tung phan tu tuong ung cua 2 mang voi nhau.
	 * @param numberOther
	 * @return a new BigInteger
	 */
	public BigInteger add(BigInteger numberOther) {
		String [] tmp = new String[2];
		int temp = 0;
		
		for (int i = 0; i < tmp.length; i++) {
			tmp[0] = this.toString();
			tmp[1] = numberOther.toString();
			
			char[] number1 = trimString(tmp[0]);
			char[] number2 = trimString(tmp[1]);
			
			if (number1.length > number2.length) {
				for (int j = 0; j < number1.length; j++) {
					addNumber(number1[j], number2[j]);
				}
			} 
			
			temp = Integer.parseInt(tmp[0]) + Integer.parseInt(tmp[1]);
			
		}	
		 return (new BigInteger(temp));
	}
	
	public BigInteger substract(BigInteger subNumber) {
		String[] tmp = new String[2];
		
		
		
		return (new BigInteger());
		
	}
	
	public boolean equals(Object other) {
		
		
		
		
		return toString().equals(other.toString());
	}
	
	

}
